﻿using MqttClientNetLib;


var mqttClient = MqttClientFactory.Create();

mqttClient.ClientOption(new MqClientOptionItem() {
    Ip = "192.168.210.201",
    Port = 1883,
    CleanSession = false,
    ClientId = "Client2"
});
mqttClient.SubscribeOption(new MqClientSubscribeItem() {
    Topic = "B",
    Level = MqQosLevel.ExactlyOnce
});

mqttClient.StartAsync();

mqttClient.ReceiveCallback(msg =>
{
    Console.WriteLine($"客户端2:" + msg.Payload);
});


Console.WriteLine("客户端2启动");
Console.ReadLine();